<!DOCTYPE HTML>
<html lang="cn" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
  <%include("/common/header.html",{title:''}){}%>
  <title>施工团队</title>
  <style>
  </style>
</head>
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=IENn7ABARjQIkTeAKyh80VTkg2jYXf3K"></script>
<body>

<div class="x-nav" style="margin: 20px auto auto 15px;">
      <span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
       <a href="javascript:;">首页</a><span lay-separator="">/</span>
        <a href="javascript:;">用户管理</a><span lay-separator="">/</span>
        <a><cite>用户列表</cite></a>
      </span>
  <a class="layui-btn layui-btn-primary layui-btn-small" style="margin: -5px 14px 0px 0px;float:right;"
     href="javascript:location.replace(location.href);" title="刷新">
    <i class="layui-icon layui-icon-refresh-3"></i>
  </a>
</div>

<div class="layui-form layui-card-header layuiadmin-card-header-auto">
  <div class="layui-form-item">
    <div class="layui-input-inline">
      <input type="text" id="search_term" placeholder="请输入内容" class="layui-input">
    </div>
    <div class="layui-input-inline">
      <button class="layui-btn layui-btn-checked" lay-submit="" lay-filter="sreach" id="searchBtn"><i
              class="layui-icon layui-icon-search"></i>查询
      </button>
    </div>
  </div>
</div>

<div class="layui-fluid">
  <div class="layui-card">
    <table id="LAY-user-manage" lay-filter="LAY-user-manage"></table>
    <script type="text/html" id="toolbarDemo">
      <button class="layui-btn layui-btn layui-btn-sm">用户列表</button>
    </script>
    <script type="text/html" id="table-useradmin-webuser">
      <a class="layui-btn  layui-btn-xs" lay-event="superior"><i class="layui-icon layui-icon-form"></i>上级</a>
      <a class="layui-btn  layui-btn-xs" lay-event="belongTo"><i class="layui-icon layui-icon-form"></i>所属代理商</a>
      <a class="layui-btn  layui-btn-xs" lay-event="listen"><i class="layui-icon layui-icon-form"></i>监测数据</a>
      <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i
              class="layui-icon layui-icon-edit"></i>修改</a>
      <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
    </script>
    <!--查看设备-->
    <script type="text/html" id="table-useradmin-webuser-b">
      <a class="layui-btn  layui-btn-xs" lay-event="shebei"><i class="layui-icon layui-icon-form"></i>查看</a>
    </script>
    <!--增值功能-->
    <script type="text/html" id="table-useradmin-webuser-c">
      <a class="layui-btn  layui-btn-xs" lay-event="zengzhi">选择</a>
    </script>
    <!--激活状态-->
    <script type="text/html" id="isCross-sysUser">
      {{#  if(d.isCross === 1){ }}
      <div style="color: #0e94ea">审核中</div>
      {{#  } }}
      {{#  if(d.isCross === 0){ }}
      <div style="color: cadetblue">已激活</div>
      {{#  } }}
      {{#  if(d.isCross ===2){ }}
      <div style="color: red">未通过</div>
      {{#  } }}
    </script>
  </div>
</div>

<!--弹出查看-->
<div class="layui-form" lay-filter="layuiadmin-form-useradmin"
     id="layuiadmin-form-useradmin"
     style="padding: 15px;display: none">
  <form class="layui-form" action="" lay-filter="component-form-element" id="myform">
    <input type="hidden" name="agent_id">
    <input type="hidden" name="saleMan_id">
    <input type="hidden" name="id">
    <div class="layui-form-item">
      <label class="layui-form-label">*账号</label>
      <div class="layui-input-inline">
        <input type="text" name="phone" lay-verify="required" placeholder="请输入账号" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*密码</label>
      <div class="layui-input-inline">
        <input type="text" name="passWord" lay-verify="required" placeholder="请输入密码" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*名称</label>
      <div class="layui-input-inline">
        <input type="text" name="name" lay-verify="required" placeholder="请输入用户名称" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*地址</label>
      <div class="layui-input-inline">
        <input type="text" name="address" lay-verify="required" placeholder="请输入用户地址" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*个人/企业</label>
      <div class="layui-input-inline">
        <input type="radio" name="isPerson" lay-verify="required" class="layui-input" title="个人" value="0">
        <input type="radio" name="isPerson" lay-verify="required" class="layui-input" title="企业" value="1">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*身份证号/社会信用代码</label>
      <div class="layui-input-inline">
        <input type="text" name="idCard" lay-verify="required" placeholder="请输入证件号" class="layui-input">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">*联系方式</label>
      <div class="layui-input-inline">
        <input type="text" name="mobile" lay-verify="required" placeholder="请输入联系方式" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*开户行名称</label>
      <div class="layui-input-inline">
        <input type="text" name="bankName" lay-verify="required" placeholder="请输入开户行名称" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*银行卡号</label>
      <div class="layui-input-inline">
        <input type="text" name="bankNum" lay-verify="required" placeholder="请输入银行卡号并核实" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">邮箱</label>
      <div class="layui-input-inline">
        <input type="text" name="email" placeholder="请输入邮箱" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">固定电话</label>
      <div class="layui-input-inline">
        <input type="text" name="telePhone" placeholder="请输入固定电话(可选填)" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*注册时间</label>
      <div class="layui-input-inline">
        <input type="text" name="createDate" readonly="readonly" placeholder="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">*到期时间</label>
      <div class="layui-input-inline">
        <input type="text" name="endTime" readonly="readonly" placeholder="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block" style="margin-top: 60px">
        <button class="layui-btn" lay-submit="" lay-filter="component-form-element">立即提交</button>
      </div>
    </div>
  </form>
</div>

<!--弹出设备-->
<div class="layui-form" lay-filter="layuiadmin-form-useradmin-a"
     id="layuiadmin-form-useradmin-a"
     style="padding: 15px;display: none">
  <form class="layui-form" action="" lay-filter="component-form-element-a" id="myform2">
    <div class="layui-form-item">
      <h3 class="layui-form-label">商品信息</h3>
      <table class="layui-table" lay-size="lg">
        <thead>
        <tr>
          <th width="200">名称</th>
          <th width="40">单价</th>
          <th width="30">数量</th>
        </tr>
        </thead>
        <tbody id="yigougoods">

        </tbody>
      </table>
    </div>

  </form>
</div>
<!--上级信息-->
<div class="layui-form" lay-filter="layuiadmin-form-useradmin-b"
     id="layuiadmin-form-useradmin-b"
     style="padding: 15px;display: none">
  <form class="layui-form" action="" lay-filter="component-form-element-b" id="myform3">
    <input type="hidden" name="id">
    <div class="layui-form-item">
      <label class="layui-form-label">姓名:</label>
      <div class="layui-input-inline">
        <input type="text" id="sname" lay-verify="required" readonly="readonly" placeholder="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">电话:</label>
      <div class="layui-input-inline">
        <input type="text" id="sphone" lay-verify="required" readonly="readonly" placeholder="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">区域:</label>
      <div class="layui-input-inline">
        <input type="text" id="saddress" lay-verify="required" readonly="readonly" placeholder="" class="layui-input">
      </div>
    </div>

  </form>
</div>

<!--所属代理商信息-->
<div class="layui-form" lay-filter="layuiadmin-form-useradmin-d"
     id="layuiadmin-form-useradmin-d"
     style="padding: 15px;display: none">
  <form class="layui-form" action="" lay-filter="component-form-element-d">
    <input type="hidden" name="id">
    <div class="layui-form-item">
      <label class="layui-form-label">名称:</label>
      <div class="layui-input-inline">
        <input type="text" name="name" id="aname" readonly placeholder="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">电话:</label>
      <div class="layui-input-inline">
        <input type="text" name="phone" id="aphone" readonly placeholder="" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">地址:</label>
      <div class="layui-input-inline">
        <input type="text" name="address" id="a_address" readonly placeholder="" class="layui-input">
      </div>
    </div>
  </form>
</div>


<!--弹出附加功能-->
<div class="layui-form" lay-filter="layuiadmin-form-useradmin-e"
     id="layuiadmin-form-useradmin-e"
     style="padding: 15px;display: none">
  <form class="layui-form" action="" lay-filter="component-form-element-e" id="myform5">
    <input type="hidden" name="id">

    <div id="listlist">

    </div>


    <div class="layui-form-item">
      <div class="layui-input-block" style="margin-top: 60px">
        <button class="layui-btn" lay-submit="" lay-filter="component-form-element-b">立即提交</button>
      </div>
    </div>
  </form>
</div>
<script id="goods2" type="text/html">
  {{#  layui.each(d.list, function(index, item){ }}
  <div class="layui-form-item">
    <label class="layui-form-label">{{item.serviceName}}:</label>
    <div class="layui-input-inline">
      <input type="checkbox" lay-filter="serviceadd" name="addservice" data-value="{{item.id}}" value="{{item.id}}"
             title="{{item.serviceName}}" class="layui-input">
    </div>
  </div>
  <!--  <input type="checkbox" lay-filter="serviceadd" name="addservice" data-value="{{item.pice}}" value="{{item.id}}" title="{{item.serviceName}}">-->
  {{#  }); }}
</script>
<%include("/common/foot.html"){}%>
<script id="edgoods" type="text/html">
  {{#  layui.each(d.list, function(index, item){ }}
  <tr>
    <td>{{item.goods.goodName}}</td>
    <td>{{item.goods.price}}</td>
    <td>{{item.numbers}}</td>
  </tr>
  {{#  }); }}
</script>
<!--标段-->
<script>
  layui.use(['index', 'table', 'jquery', 'form', 'laytpl', 'laydate', 'layedit', 'AjaxCommon', 'AliangLayui', 'AliangCommon'], function () {
    var $ = layui.$;
    var table = layui.table;
    var form = layui.form;
    var laydate = layui.laydate;
    var AjaxCommon = layui.AjaxCommon;
    var AliangLayui = layui.AliangLayui;
    var laytpl = layui.laytpl;

    var title = "开设账户";
    var findAll_url = "adminUser/findAll.jhtml";
    var delete_url = "adminUser/delete.jhtml";
    var saveUserInfo_url = "saleMan/sys/updateUser.jhtml";
    var saveaddservice_url = "saleMan/sys/saveaddservice.jhtml";
    var index;//定义建立富文本编辑器全局变量
    var layedit;//定义富文本编辑器layedit全局变量
    var cols = [ //表头
      //  {field:'id',sort:'true',title:'序号',align:'center'},
      {field: 'name', title: '用户名称', align: 'center'},
      {
        field: 'createDate',
        title: '注册时间',
        align: 'center',
        templet: "<div>{{layui.util.toDateString(d.createDate, 'yyyy-MM-dd ')}}</div>"
      },
      {field: 'address', title: '地址', align: 'center'},
      {title: '设备', sort:'true', toolbar: '#table-useradmin-webuser-b',align:'center'},
      {field: 'healthScore', title: '健康分值', align: 'center'},
      {field: 'mobile', title: '联系方式', align: 'center'},
      {field: 'isCross',title:'激活状态',align: 'center',toolbar: '#isCross-sysUser'},
      {title: '开通功能', sort: 'true', width: 100, toolbar: '#table-useradmin-webuser-c', align: 'center'},
      {title: '操作', fixed: 'right', width: 400, toolbar: '#table-useradmin-webuser', align: 'center'}
    ];

    var keyWord;
    $('#searchBtn').on('click', function () {
      keyWord = $('#search_term').val();
      if ("" == keyWord || undefined == keyWord) {
        window.location.reload();
      } else {
        table.reload('listReload', {
          url: findAll_url,
          where: {
            name: keyWord
          },
          page: {
            curr: 1//重新从第 1 页开始
          }
        });
      }
    });
    AliangLayui.createTable(
      "#LAY-user-manage",
      "listReload",
      "#toolbarDemo",
      title,
      findAll_url,
      true,
      [10, 15, 20, 25],
      ['filter', 'print', 'exports'],
      cols,
      null
    );

    // function ty(data){
    //   if (data==1){
    //     return "鸡舍"
    //   }else if(data==2){
    //     return "牛舍"
    //   }else if(data==3){
    //     return "猪舍"
    //   }else if(data==4){
    //     return "兔舍"
    //   }else if(data==5){
    //     return "鸭舍"
    //   }
    // }
    // function dataStr(data){
    //   if (data!=null){
    //     var newStr=data.split(",");
    //     var newArray=[];
    //     newArray=newStr.map(function(data){
    //       return +data;
    //     })
    //     return newArray;
    //   }
    // }

    var title1 = "开设账号";
    var size = ['100%', '100%'];

    function initUpdate(data) {
      $('#myform')[0].reset();
      layer.open({
        type: 1,
        title: title1,
        area: size,
        content: $('#layuiadmin-form-useradmin'),
        cancel: function (index, layero) {//取消事件
          location.replace(location.href);　//layer.open关闭刷新
        },
        success: function (layero, index) {
          layer.iframeAuto(index);
        }
      });

      //富文本表单验证
      form.verify({
        introduce: function (value) {
          var val = layedit.getText(index);
          if (val.length < 6) {
            return '内容至少6个字符'
          }
        }
      });
      layui.form.val("component-form-element", loadData(data));
    }

    //弹出设备
    function openSheBei(data) {
      layer.open({
        type: 1,
        title: "设备",
        area: ['100%', '100%'],
        content: $('#layuiadmin-form-useradmin-a')
      });

      var findOrderInfo="view/findOrderInfo.jhtml"
      $.ajax({
        url:findOrderInfo,
        type: "POST",
        data: {
          "sid": data
        },
        dataType:'json',
        success: function (ret) {
          console.log(JSON.stringify(ret))
          var data=ret.data;
          var laytpl = layui.laytpl;
          var ret2 = { //数据
            "list": data[0].detailsSet
          };
          laytpl($("#edgoods").html()).render(ret2, function (html) {
            $("#yigougoods").html(html);
          });
        }
      })
    }

    //附加功能选项
    function openZengZhi(data) {
      //alert(data)
      console.log(data)
      layer.open({
        type: 1,
        title: "增值功能",
        area: ['100%', '100%'],
        content: $('#layuiadmin-form-useradmin-e')
      });
      var datas = {
        'id': data.id
      }

      layui.form.val("component-form-element-e", loadData(datas));
      $.ajax({
        url: "purchaseserviceorder/list/find.jhtml",
        type: "POST",
        data: {},
        dataType: "json",
        success: function (ret) {
          //alert(JSON.stringify(ret))
          var laytpl = layui.laytpl;
          var ret2 = { //数据
            "list": ret.obj
          };
          laytpl($("#goods2").html()).render(ret2, function (html) {
            $("#listlist").html(html);
          });

          $("input:checkbox[name='addservice']").each(function (i, item) {
            for (let j = 0; j < data.addServiceDetails.length; j++) {
              if (data.addServiceDetails[i].addService.id == $(item).val()) {
                $(item).attr("checked", true);

              }
            }
            form.render();
            /*    if (){

                }*/
            // alert($(item).val())
            //alert()
          });
        },
        error: function (jqXHR, textStatus, errorThrown) {
        }
      });

    }

    form.on('checkbox(serviceadd)', function (data) {
      // alert($(data.elem).data("value"))


    })
    var findByAgent_url = "saleMan/sys/findByAgent.jhtml";

    var findBySaleMAN_URL = "saleMan/sys/findBySaleMan.jhtml"

    function initUpdateSuperior(data) {
      var title1 = "上级信息";
      layer.open({
        type: 1,
        title: title1,
        area: ['500px', '400px'],
        content: $('#layuiadmin-form-useradmin-b'),
        btn: ['关闭'], //可以无限个按钮
        cancel: function (index, layero) {//取消事件
          location.replace(location.href);　//layer.open关闭刷新
        },
        success: function (layero, index) {
          layer.iframeAuto(index);
        }
      });
      $.ajax({
        url: findBySaleMAN_URL,
        type: "POST",
        data: {
          "sid": data
        },
        success: function (ret) {
          console.log(JSON.stringify(ret.data))
          layui.form.val("component-form-element-d", loadUp(ret.data))
        }
      })
    }

    function loadUp(data) {
      $("#sname").val(data.name)
      $("#sphone").val(data.phone)
      $("#saddress").val(data.address)
    }


    function initUpdateBelongTo(data) {
      var title1 = "所属代理商";
      layer.open({
        type: 1,
        title: title1,
        area: ['500px', '400px'],
        content: $('#layuiadmin-form-useradmin-d'),
        btn: ['关闭'], //可以无限个按钮
        cancel: function (index, layero) {//取消事件
          location.replace(location.href);　//layer.open关闭刷新
        },
        success: function (layero, index) {
          layer.iframeAuto(index);
        }
      });
      $.ajax({
        url: findByAgent_url,
        type: "POST",
        data: {
          "aid": data
        },
        success: function (ret) {
          console.log(JSON.stringify(ret.data))
          layui.form.val("component-form-element-d", loadBelong(ret.data))
        }
      })
    }

    function loadBelong(data) {
      $("#aname").val(data.name)
      $("#aphone").val(data.phone)
      $("#a_address").val(data.address)
    }

    function loadData(data) {
      var ret = {
        "id": data.id,
        "phone": data.phone,
        "passWord": data.passWord,
        "name": data.name,
        "idCard": data.idCard,
        "mobile": data.mobile,
        "bankName": data.bankName,
        "bankNum": data.bankNum,
        "createDate": data.createDate,
        "endTime": data.endTime,
        "telePhone": data.telePhone,
        "healthScore": data.healthScore,
        "email": data.email,
        "idCard": data.idCard,
        "address": data.address,
        "placeType": data.placeType,
        "agent_id": data.agent_id,
        "saleMan_id": data.saleMan_id,
        "placeType": data.placeType
      };
      //isPerson
      if (data.isPerson == 0) {
        $("input:radio[value=0]").attr("checked", "checked")
      } else {
        $("input:radio[value=1]").attr("checked", "checked")
      }
      // for (let i = 0; i < dataStr(data.placeType).length; i++) {
      //   var place=dataStr(data.placeType)[i];
      //   $("input:checkbox[value='"+place+"']").attr("checked","checked");
      // }
      form.render();
      return ret;
    }

    $.fn.ghostsf_serialize = function () {
      var a = this.serializeArray();
      var $radio = $('input[type=checkbox]', this);
      var temp = {};
      $.each($radio, function () {
        if (!temp.hasOwnProperty(this.name)) {
          if ($("input[name='" + this.name + "']:checked").length == 0) {
            temp[this.name] = "";
            a.push({name: this.name, value: ""});
          }
        }
      });
      return a;
    };

    form.on('submit(component-form-element)', function () {
      var formObject = {};
      var formArray = $("#myform").ghostsf_serialize();
      $.each(formArray, function (i, item) {
        formObject[item.name] = item.value;
      })
      var checkbox = [];
      $("input[name=placeType]:checked").each(function (index, item) {
        checkbox.push(item.value)
      });
      formObject["placeType"] = checkbox.toString();
      console.log(JSON.stringify(formObject))
      postUpdate(formObject);
      return false;
    });


    form.on('submit(component-form-element-e)', function (data) {
      postUpdateaddservice(data);
      return false;
    });


    //头工具栏事件
    table.on('toolbar(LAY-user-manage)', function (obj) {
      var checkStatus = table.checkStatus(obj.config.id);
      switch (obj.event) {
        case 'add':
          initUpdate();
          break;
        case 'delete':
          var data = checkStatus.data;
          if (data.length > 0) {
            //var id = new Array(); //声明数组
            for (var i in data) {
              var a = data[i].id;//得到复选框的值
              postDelete(a);
            }
          } else {
            layer.msg("至少选择一个进行删除");
          }
          break;
        case 'export':
          layer.msg("导出");
          break;
      }
    });

    //点击每行右工具栏“操作”里面按钮效果
    table.on('tool(LAY-user-manage)', function (obj) {
      var data = obj.data;
      if (obj.event === 'edit') {
        initUpdate(data);
        // upData(data);
      } else if (obj.event === 'view') {
        initUpdate1(data);
      } else if (obj.event === 'superior') {
        //上级
        initUpdateSuperior(data.saleMan_id);
      } else if (obj.event === 'belongTo') {
        //所属代理商
        initUpdateBelongTo(data.agent_id);
      } else if (obj.event === 'del') {
        layer.confirm('删除以后数据将不能恢复，确定删除吗？', function (index) {
          postDelete(data.id);
        });
      } else if (obj.event === 'shebei') {
        openSheBei(data.id);
      } else if (obj.event === 'zengzhi') {
        openZengZhi(data);
      }else if (obj.event==='listen'){
         // alert(obj.data.id)
        parent.layui.index.openTabsPage("base/link/@/dataShow/dataShow.jhtml?name="+obj.data.name+"&id="+obj.data.id, obj.data.name);
        //window.location.href="base/link/@/dataShow/dataShow.jhtml"
      }
    });
    //ajax提交删除内容\
    window.postDelete = function (id) {
      $.ajax({
        url: delete_url,
        type: "POST",
        data: {
          "id": id
        },
        success: function (ret) {
          if (ret == null) {
            layer.msg("删除失败", {
              icon: 5
            });
          } else {
            layer.msg("删除成功", {
              icon: 6
            });
            layer.closeAll();
            table.reload('listReload');
          }
          return ret;
        }
      })
    };

    window.postUpdateaddservice = function (data) {
      var formData = new FormData();
      formData.append("id", data.field.id);
      var arr = new Array();
      $("input:checkbox[name='addservice']:checked").each(function (i) {
        arr[i] = $(this).val();
        //alert()
      });
      formData.append("addservice", arr);
      $.ajax({
        url: saveaddservice_url,
        type: "POST",
        data: formData,
        processData: false,
        contentType: false,
        success: function (data) {
          if (data.code == 0) {
            layer.closeAll();
            layer.msg(data.msg, {time: 600, icon: 1}, function () {
              table.reload('listReload');
            });
            location.replace(location.href);
          } else {
            layer.msg(data.msg, {icon: 6});
          }
        },
        error: function (jqXHR, textStatus, errorThrown) {
          var estr = "Page:" + window.location.pathname + ",Function:postUpdate()";
          layer.open({
            title: "错误信息",
            type: 2,
            content: "base/error.jhtml?info=" + estr,
            btn: ['关闭'] //可以无限个按钮
          });
        }
      });
    };
    window.postUpdate = function (data) {
      var formData = new FormData();
      formData.append("data", JSON.stringify(data));
      $.ajax({
        url: saveUserInfo_url,
        type: "POST",
        data: formData,
        processData: false,
        contentType: false,
        success: function (data) {
          if (data.code == 0) {
            layer.closeAll();
            layer.msg(data.msg, {time: 600, icon: 1}, function () {
              table.reload('listReload');
            });
            location.replace(location.href);
          } else {
            layer.msg(data.msg, {icon: 6});
          }
        },
        error: function (jqXHR, textStatus, errorThrown) {
          var estr = "Page:" + window.location.pathname + ",Function:postUpdate()";
          layer.open({
            title: "错误信息",
            type: 2,
            content: "base/error.jhtml?info=" + estr,
            btn: ['关闭'] //可以无限个按钮
          });
        }
      });
    };
  });

</script>
<script>
  function show() {
    layer.tips("左边么么哒", "#" + id + "", {
      tips: [4, "#4794ec"]
    });
  }
</script>
</body>
</html>
